Skip to content

fix: fix timezone issues for getMonths function #818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

fix: fix timezone issues for getMonths function #818

wants to merge 1 commit into from

Conversation

brunolopesr
Copy link

This pull request addresses issue #817

The date used to map the array of month numbers should not have explicitly set timezone in its ISO 8601 string, because in timezones like America/Sao_Paulo which has a negative offset of -3 hours, all dates will be computed one day earlier, eg: Sat Dec 31 2016 22:00:00 GMT-0200 (Horário de Verão de Brasília)

This will make the array of months to be something like: ['December', 'January', 'February', ..., 'November'], making a buggy behaviour in DatePicker and MonthPicker components.

I think the best way is to remove the timezone from the string and the timezone from the Intl.DateTimeFormat constructor, thus defaulting to the system timezone.

Also as I was running the tests in a negative offset, I made some adjustments to the timezone.spec.ts tests.

@Jasenkoo
Copy link
Contributor

I already have a fix for it, a simpler change. Tnx for the PR tho.

@Jasenkoo Jasenkoo closed this Apr 10, 2024
@brunolopesr
Copy link
Author

brunolopesr commented Apr 10, 2024

Guess I will need to use my fork of the library then.

@gislainy

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants